﻿module Sustainalytics.CompanySearch.Admin {

    import Common = Sustainalytics.Common;
    import SearchBox = Sustainalytics.SearchBox;

    // define company search controller
    export class CompanySearchAdminController {
        private $scope: ng.IScope;
        private $location: ng.ILocationService;
        private searchData: string;

        // Ctor.
        public constructor($scope: ng.IScope, $location: ng.ILocationService) {
            this.$scope = $scope;
            this.$location = $location;

            // associate scope with current instance
            this.$scope['companySearch'] = this;
        }

        // Redirect to Governance page.
        public goToGovernanceAdminPage(company: CorporateDataExtendedDto) {
            var ctx = this;

            // redirect to Governance admin page
            this.$location.path('/governancereports/' + company.id);
        }
    }

    // get module
    var companySearchModule = angular.module('Sustainalytics.CompanySearch.Admin');

    // register company search controller
    companySearchModule.controller('CompanySearchAdminController', ['$scope','$location', CompanySearchAdminController]);
}